﻿#region << 文 件 说 明 >>

/*----------------------------------------------------------------
// 文件名称：MainViewModel
// 创 建 者：杨程
// 创建时间：2021/10/19 10:18:59
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//
//
//----------------------------------------------------------------*/

#endregion

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using test.Model;
using test.ViewModel;
using test.ViewModel.SourceGenerator;
using TouchSocket.Core;
using TouchSocket.Sockets;
using Vampirewal.Core;
using Vampirewal.Core.Attributes;
using Vampirewal.Core.Components;
using Vampirewal.Core.ComputerInfo;
using Vampirewal.Core.ConfigOptions;
using Vampirewal.Core.EventBus;
using Vampirewal.Core.GeneralTree;
using Vampirewal.Core.Interface;
using Vampirewal.Core.Models;
using Vampirewal.Core.Models.TreeModel;

//using Vampirewal.Core.VContainer;
using Vampirewal.Core.OperationExcelService;
using Vampirewal.Core.RuleEngine;
using Vampirewal.Core.ScheduledTask;
using Vampirewal.Core.SimpleMVVM;
using Vampirewal.Core.WindoSetting;
using Vampirewal.Core.Extensions;

namespace test;

//public class MainViewModel:BaseCRUDVM<TestModel>
//{
//    private IDialogMessage Dialog { get; set; }
//    public MainViewModel(IDialogMessage dialog,IAppConfig appConfig):base()
//    {
//        appConfig.ConfigPath = $"{AppDomain.CurrentDomain.BaseDirectory}UpdateConfig";
//        appConfig.ConfigName = "UpdateConfig.json";
//        appConfig.LoadAppConfig();
//        Config=appConfig;

//        //构造函数
//        Dialog = dialog;

//        //log.DebugLog("测试", "MainView");
//        Entity.hahas.Add("asd");
//        Entity.hahas.Add("asd");
//        Entity.hahas.Add("asd");
//        Entity.hahas.Add("asd");

//        GetAllEquip();
//    }

//    public override void InitData()
//    {
//        Equips = new ObservableCollection<Equip>();
//    }

//    #region 属性
//    private string _OldStr;

//    public string OldStr
//    {
//        get { return _OldStr; }
//        set { _OldStr = value; DoNotify(); }
//    }

//    private string _NewStr;

//    public string NewStr
//    {
//        get { return _NewStr; }
//        set { _NewStr = value; DoNotify(); }
//    }

//    public ObservableCollection<Equip> Equips { get; set; }

//    public List<string> orderbys { get; set; }=new List<string>() { "Province", "City" };
//    #endregion

//    #region 公共方法

//    #endregion

//    #region 私有方法
//    private void GetAllEquip()
//    {
//        //测试
//        for (int i = 0; i < 30; i++)
//        {
//            Equips.Add(new Equip()
//            {
//                EquipName = $"S{i}",
//                Province = "四川省",
//                City = "成都市"
//            });
//        }

//        for (int i = 0; i < 45; i++)
//        {
//            Equips.Add(new Equip()
//            {
//                EquipName = $"S{i}",
//                Province = "四川省",
//                City = "南充市"
//            });
//        }

//        for (int i = 0; i < 55; i++)
//        {
//            Equips.Add(new Equip()
//            {
//                EquipName = $"Y{i}",
//                Province = "云南省",
//                City = "昆明市"
//            });
//        }

//    }
//    #endregion

//    #region 命令
//    public RelayCommand OpenDialogWindowCommand => new RelayCommand(() =>
//    {
//        FrameworkElement testview = Messenger.Default.Send<FrameworkElement>("GetView", "test.test_NewPage");

//        Dialog.OpenDialogWindow(new DialogWindowSetting()
//        {
//            UiView = testview,
//            WindowWidth = 1500,
//            WindowHeight = 600,
//            IconStr = "",
//            IsShowMaxButton = true,
//            IsShowMinButton = true,
//            TitleFontSize = 20,
//            PassData = "test",
//            IsOpenWindowSize = true
//        });

//        //Dialog.OpenVampirewalFolderBrowserDialog();

//        //FrameworkElement testview = Messenger.Default.Send<FrameworkElement>("GetView", "test.NotifyTestUserControl");

//        //Dialog.OpenNotifyWindow(new NotifyWindowSetting()
//        //{
//        //    UiView = testview,
//        //    //WindowWidth =300,
//        //    //WindowHeight =450,
//        //    DelayCloseTime =0,
//        //    NotifyTitle="测试通知",
//        //    PassData="Passdata"
//        //});
//    });

//    public RelayCommand ConvertCommand => new RelayCommand(() =>
//    {
//        //byte[] byteArray = System.Text.Encoding.Default.GetBytes(OldStr);

//        //int aa= Convert.ToInt32(OldStr, 16);

//        //NewStr = aa.ToString();

//        Entity.hahas.Add("asd");

//    });

//    public RelayCommand TextChangeDcommand => new RelayCommand(() =>
//    {
//        var aaa = Entity.hahas;

//        //Config.Save();
//    });

//    public RelayCommand<string> SearchCommand => new RelayCommand<string>((s) =>
//    {
//    });
//    #endregion
//}
//[PropertyNotifyIntercept]

//[VampirewalAopIntercept]
//[AddPropertyNotifyIntercept]
[VampirewalIoCRegister("MainViewModel2")]
public partial class MainViewModel2 : BillVM<TestBillModel>
{
    private IVampirewalCoreDialogMessage Dialog { get; set; }
    private IVampirewalOperationExcelService excelService { get; set; }

    private IVampirewalCoreMdiViewService _MdiService;

    public IVampirewalCoreMdiViewService MdiService
    {
        get { return _MdiService; }
        set { _MdiService = value; OnPropertyChanged(); }
    }

    private IApplicationService AppService { get; set; }

    [ObservableProperty]
    public testNotify notify;

    [ObservableProperty]
    private IConfigContainer<AppBaseOptions> tc;

    //private ILogger Log { get; set; }
    public MainViewModel2(IVampirewalCoreDialogMessage dialog, IVampirewalOperationExcelService operationExcel, IVampirewalCoreLogService logger, IVampirewalCoreEventBusFactory factory, IVampirewalCoreComputerService computer, IVampirewalCoreMdiViewService mdiService, IVampirewalCoreScheduledTaskService scheduled,IApplicationService appService, IConfigContainer<AppBaseOptions> tc,IVampirewalCoreAppConfig appConfig,IVampirewalCoreEventAggregatorService eventService) : base()
    {
        Tc=tc;
        //var aaa= dialog.OpenVampirewalFolderBrowserDialog("H:\\Codes");

        //face.aaa();
        //rule.Run<TestModel>("haha", new TestModel() { Name = "傻屌" });

        //logger.DebugLog("abc", "aaa");

        //Log = log;
        Dialog = dialog;
        excelService = operationExcel;
        AppService=appService;
        Title = "测试窗体";

        //Dialog.OpenNotifyWindow(new NotifyWindowSetting()
        //{
        //    UcView = WindowsManager.GetInstance().GetView("NotifyDefultView"),
        //    NotifyTitle = "测试弹窗",
        //    PassData = "测试传输过去的数据",
        //    TitleFontSize = 16,
        //    Background = "#ffffff",
        //    DelayCloseTime = 3,
        //    Foreground = "#ffffff",
        //    WindowBorderBrush = "#ffffff",
        //    WindowHeight = 300,
        //    WindowWidth = 150
        //});

        //Dialog.OpenNormalWindow(new DialogWindowSetting()
        //{
        //    UcView = WindowsManager.GetInstance().GetView("TestNewPageView", "TestNewPageViewModel"),
        //    WindowWidth = 800,
        //    WindowHeight = 600,
        //    IsShowMaxButton = false,
        //    IsShowMinButton = false,
        //    IsOpenWindowSize = false,
        //    TitleFontSize = 15,
        //    IconStr = "",
        //    CloseDialogWindowCallBackCommand = new CommunityToolkit.Mvvm.Input.RelayCommand(() =>
        //    {
        //    }),
        //    CloseDialogWindowCallBackCommandParameter = "test"
        //});

        //Application.Current.Dispatcher.BeginInvoke(new Action(() =>
        //{
        //}));

        UserList2 = new TreeBuilderByFullLoad<Sys_User>();

        List<Sys_User> cur = new List<Sys_User>();

        Sys_User c1 = new Sys_User()
        {
            CurId = Guid.NewGuid().ToString(),
            ParentId = Guid.Empty.ToString(),
            UserName = "c1",
            LoginID = "abc",
            Gender = 1,
            Passwod = "yc"
        };

        cur.Add(c1);

        Sys_User c2 = new Sys_User()
        {
            CurId = Guid.NewGuid().ToString(),
            ParentId = c1.CurId,
            UserName = "c2",
            LoginID = "abc",
            Gender = 1
        };

        cur.Add(c2);

        Sys_User c3 = new Sys_User()
        {
            CurId = Guid.NewGuid().ToString(),
            ParentId = c1.CurId,
            UserName = "c3",
            LoginID = "abc",
            Gender = 1
        };

        cur.Add(c3);

        Sys_User cc1 = new Sys_User()
        {
            CurId = Guid.NewGuid().ToString(),
            ParentId = c2.CurId,
            UserName = "cc1",
            LoginID = "abc",
            Gender = 1
        };
        cur.Add(cc1);
        Sys_User cc2 = new Sys_User()
        {
            CurId = Guid.NewGuid().ToString(),
            ParentId = c3.CurId,
            UserName = "cc2",
            LoginID = "abc",
            Gender = 1,
            Passwod = "yc"
        };

        cur.Add(cc2);

        Sys_User ccc1 = new Sys_User()
        {
            CurId = Guid.NewGuid().ToString(),
            ParentId = cc2.CurId,
            UserName = "ccc1",
            LoginID = "abc",
            Gender = 1,
            Passwod = "yc"
        };
        cur.Add(ccc1);

        UserList2.LoadFullNodes(cur);
        UserList3 = [.. UserList2.GetSourceItems()];


        for (int i = 0; i < 100; i++)
        {
            Sys_User uu = new Sys_User()
            {
                CurId = Guid.NewGuid().ToString(),
                ParentId = cc2.CurId,
                UserName = $"user_{i}",
                LoginID = "abc",
                Gender = 1,
                Passwod = "yc"
            };

            UserList3.Add(uu);
        }

        #region 自定义实体弹窗选择
        Dialog.OpenCustomSelectorView<Sys_User>(() =>
        {
            return new DialogWindowSetting()
            {
                PassData = cur,
                WindowWidth = 1366,
                WindowHeight = 768,

            };
        },
        result =>
        {

        });
        #endregion

        #region 事件聚合器

        eventService.Subscribe<Sys_User>(uu =>
        {
            uu.UserName = "被事件聚合器改过";
        });

        eventService.Publish(c1);

        #endregion

        //UserList2.ExpandNodeByLevelNum(99);

        //TreeListViewActionsCommand = new IEventAction[]
        //{
        //    new EventAction<object,RoutedPropertyChangedEventArgs<object>>("SelectedItemChanged", TreeListViewSelectedItemChanged)
        //};

        //notify = InterceptClassFactory.GetInterceptClass<testNotify>("haha", 12);

        Notify = new testNotify("haha", 12);
        Notify["asd"] = "傻屌";

        var abc = tc.Value;

        ////var map= VConfig.GetOptions<ConnectionOptions>();

        //string asd = VampirewalCoreContext.GetInstance().GetOptionsValue<string>("AppBaseOptions:AppChineseName");

        abc.AppVersion = "2.0.0.234";
        abc.AppChineseName = "哈哈";

        VampirewalCoreContext.GetInstance().SetOptions(abc);

        TestViewModel model = new TestViewModel();

        model.Age = 10;
        model.StartCommand.Execute(1);

        //factory.Publish("TestEventBus", "傻屌");
        //factory.Publish("TestEventBus", "傻屌2");

        factory.Publish<TestEventBus>("傻屌3");
        //factory.Publish<TestEventBus>("傻屌4");
        factory.PublishParallel<TestEventBus>("Hello World");
        //if (!Directory.Exists($"{AppDomain.CurrentDomain.BaseDirectory}//ErrorLog//{DateTime.Today.ToString("yyyy_MM_dd")}"))
        //{
        //    Directory.CreateDirectory($"{AppDomain.CurrentDomain.BaseDirectory}//ErrorLog//{DateTime.Today.ToString("yyyy_MM_dd")}");
        //}

        //File.AppendAllText($"{AppDomain.CurrentDomain.BaseDirectory}//ErrorLog//{DateTime.Today.ToString("yyyy_MM_dd")}//ExceptionLog.txt", "haha");

        SqlSugarRepository<TestModel> rep = VampirewalCoreContext.GetInstance().GetService<SqlSugarRepository<TestModel>>();

        //Task.Run(() =>
        //{
        //    while (true)
        //    {
        //        Memory = computer.GetComputerInfo();

        //    }
        //    IVampirewalCoreDataContext DC = VampirewalCoreContext.GetInstance().GetService<IVampirewalCoreDataContext>();

        //});

        //VampirewalMessenger.GetInstance().Send("TestMessenger", "haha");

        Notify2 = new testNotify2Child()
        {
            TestName = "haha",
            Age = 1,
            TestStr = "test"
        };


        Vampirewal.Core.LoopAction.CreateLoopAction(10, (act) =>
        {

        }).Run();

        MdiService = mdiService;

        MdiService.CreateMdiChildView((setting) =>
        {
            setting.IconStr = "C:\\Users\\Administrator\\Desktop\\桌面备份\\Vampirewal-Logo.png";
            setting.MdiView = (IMdiChildViewBase)WindowsManager.GetInstance().GetView("TestMdiChildView");
            setting.Title = "测试";
            //setting.
        });

        EventCommands = new List<IVampirewalCoreEventCommand>()
        {
            new VampirewalCoreEventCommand("SelectedItemChanged","SelectedItemEx",TextChangedCommand)
        };


        scheduled.Running();

        VampirewalMessenger.Instance.Register(this, "TestMessenger", TestMessenger);

        var aa= VampirewalMessenger.Instance.Send<int>("TestMessenger", "aa", 123);
    }

    [CommunityToolkit.Mvvm.Input.RelayCommand]
    public void TextChanged(object value)
    {
        throw new InvalidOperationException("This is a test exception.");
    }

    private List<IVampirewalCoreEventCommand> _EventCommands;

    public List<IVampirewalCoreEventCommand> EventCommands
    {
        get { return _EventCommands; }
        set { _EventCommands = value; OnPropertyChanged(); }
    }

    private testNotify2 _notify3;
    [PropertyInfoPanel(Columns = 1)]
    public testNotify2 Notify3
    {
        get { return _notify3; }
        set { _notify3 = value; OnPropertyChanged(); }
    }

    private testNotify2 _notify2;
    [PropertyInfoPanel(Columns = 2)]
    public testNotify2 Notify2
    {
        get { return _notify2; }
        set { _notify2 = value; OnPropertyChanged(); }
    }



    private List<EnumberCreditType> _ListViewButton;

    /// <summary>
    ///
    /// </summary>
    public List<EnumberCreditType> ListViewButtonList
    {
        get
        {
            return _ListViewButton;
        }
        set
        {
            _ListViewButton = value;
            OnPropertyChanged();
        }
    }

    //public MainViewModel2()
    //{
    //    //显示SetClassificationAttribute编号0-3的值
    //    ListViewButtonList = EnumHelper.EnumToList<ListViewButton>().Where(e => e.Classification >= 0 && e.Classification <= 3).OrderBy(e => e.Classification).ToList();
    //    //显示SetClassificationAttribute编号0-4的值
    //    ListViewButtonList = EnumHelper.EnumToList<ListViewButton>().Where(e => e.Classification >= 0 && e.Classification <= 4).OrderBy(e => e.Classification).ToList();
    //    //显示SetClassificationAttribute编号2-4的值
    //    ListViewButtonList = EnumHelper.EnumToList<ListViewButton>().Where(e => e.Classification >= 2 && e.Classification <= 4).OrderBy(e => e.Classification).ToList();
    //}

    private MemoryMetrics _Memory;

    /// <summary>
    ///
    /// </summary>
    public MemoryMetrics Memory
    {
        get
        {
            return _Memory;
        }
        set
        {
            _Memory = value;
            OnPropertyChanged();
        }
    }

    //private void TreeListViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
    //{
    //    var Trees = sender as TreeListView;

    //    if (Trees.SelectedItem is GeneralTreeContainer<Sys_User> Selected)
    //    {
    //        var aaa = Selected.TreeNode;
    //    }
    //}

    public override void BillVmInitData()
    {
    }

    [ObservableProperty]
    public object selectedItem;

    public override void InitData()
    {
        //GetById("9c7d6d6c-145f-48a3-b185-3b9ba6366d10");

        //Entity.BillName = "qwerqweasdq";
    }

    public override void MessengerRegister()
    {
        //VampirewalMessenger.GetInstance().Register<string>(this, "TestMessenger", TestMessenger);

        //VampirewalMessenger.GetInstance().Send("TestAAA");
    }

    public int TestMessenger(string str,int age)
    {
        return age;
    }

    public override void PassData(object obj)
    {
    }

    public IRelayCommand<object> CloseWindowCommand => new CommunityToolkit.Mvvm.Input.RelayCommand<object>((o) =>
    {
        AppService.Shutdown();
        //WindowsManager.GetInstance().CloseAllWindow();
        //CloseView();
    });

    //public IEventAction[] TreeListViewActionsCommand { get; set; }

    //[TryCatch]

    [ObservableProperty]
    private bool isLoading;

    [ObservableProperty]
    private string loadTips;

    /// <summary>
    /// haha
    /// </summary>
    [CommunityToolkit.Mvvm.Input.RelayCommand]
    public async void Test()
    {
        var aaa= Tc.Value;


        IsLoading = true;

        await Task.Run(async () =>
        {
            //int index = 0;

            //for (int i = 0; i < 10; i++)
            //{
            //    LoadTips = $"循环到了第{i}";

            //    await Task.Delay(500);
            //}

            int index = Random.Shared.Next(1, 101);

            var aaa = UserList3.FirstOrDefault(f => f.UserName == $"user_{index}");

            SourceScrollToItem = aaa;
        });

        IsLoading = false;

        //Dialog.ShowPopupWindow(new PopupWindowSetting()
        //{
        //    Message = "haha",
        //    IsKeepOpen = false,
        //    //OwnerWindow = WindowsManager.GetInstance().GetWindow(ViewId),
        //    OwnerWindow= WindowsManager.GetInstance().GetActivateWindows(),
        //    Type = MessageType.Successful
        //});

        //Notify.Name = "bbb222";

        //Dialog.OpenDialogWindow(new DialogWindowSetting()
        //{
        //    UiView = WindowsManager.GetInstance().GetView("TestNewPageView", "TestNewPageViewModel"),
        //    WindowWidth = 800,
        //    WindowHeight = 600,
        //    IsShowMaxButton = false,
        //    IsShowMinButton = false,
        //    IsOpenWindowSize = false,
        //    TitleFontSize = 15,
        //    IconStr = "",
        //    CloseDialogWindowCallBackCommand = new CommunityToolkit.Mvvm.Input.RelayCommand(() =>
        //    {
        //    }),
        //    CloseDialogWindowCallBackCommandParameter = "test"
        //});

        //Dialog.OpenNotifyWindow(new NotifyWindowSetting()
        //{
        //    UcView = WindowsManager.GetInstance().GetView("NotifyDefultView"),
        //    NotifyTitle = "测试弹窗",
        //    PassData = "测试传输过去的数据",
        //    TitleFontSize = 16,
        //    Background = "#ffffff",
        //    DelayCloseTime = 3,
        //    Foreground = "#ffffff",
        //    WindowBorderBrush = "#ffffff",
        //    WindowHeight = 300,
        //    WindowWidth = 150
        //});

        
    }

    [CommunityToolkit.Mvvm.Input.RelayCommand]
    public void TestAA()
    {
    }

    [ObservableProperty]
    public bool isOnLoading = false;

    public TreeBuilderByFullLoad<Sys_User> UserList2 { get; set; }

    public ObservableCollection<Sys_User> UserList3 { get; set; }

    [ObservableProperty]
    private Sys_User sourceScrollToItem;
}

[Tenant("OtherDbName")]
public class TestBillModel_SearchModel : TestBillModel
{
    //[ExportExcelProperty(SortId = 3)]
    public string haha { get; set; }
}

public class ListVMTest(IVampirewalCoreDataContext DC, IVampirewalCoreDialogMessage dialog, IVampirewalOperationExcelService exportExcel, SqlSugarRepository<TestBillModel> _repbill, SqlSugarRepository<TestBillModel> _repSearch) : BillListBaseVM<TestBillModel, TestBillModel>(dialog, _repbill, _repSearch)
{
    public IVampirewalOperationExcelService ExportExcelService { get; private set; } = exportExcel;

    protected override void InitVM()
    {
        //Queryable = DC.Client.Queryable<TestBillModel>().Where(w => w.BillId == "33732ce4-d877-43cc-8ea1-ef5c3e4bc720");

        //var sqlsugar= DC.Client.Queryable<TestBillModel>().Where(w=>w.BillId== "33732ce4-d877-43cc-8ea1-ef5c3e4bc720").Select<TestBillModel_SearchModel>(s=>new TestBillModel_SearchModel() { });

        //GetPageList();

    }

    protected override IUcViewBase SetView()
    {
        return VampirewalMessenger.GetInstance().Send<IUcViewBase>("GetView", "test.test_NewPage");
    }

    public override void ExecuteBeforeCloseDialogWindow(object obj)
    {
        //Config.Save();
        ExportExcelService.ExportDataToExcel(EntityList.ToList(), AppDomain.CurrentDomain.BaseDirectory, Vampirewal.Core.OperationExcelService.ExcelType.xlsx);

        //var aaa= ExportExcelService.ExcelToList<TestBillModel_SearchModel>(true, $"{AppDomain.CurrentDomain.BaseDirectory}TestBillModel_SearchModel.xlsx");
    }
}

//[AddPropertyNotifyIntercept]
public partial class testNotify : DynamicModelBase
{
    public testNotify()
    {
    }

    public testNotify(string name, int age)
    {
        Name = name;
        Age = age;
    }

    [ObservableProperty]
    public string name;

    [ObservableProperty]
    public int age;

    public virtual testNotify2 testNotify22 { get; set; }
}

//[AddPropertyNotifyIntercept]
public partial class testNotify2 : ValidationBaseModel
{
    //
    [ObservableProperty]
    private string name;

    private string _TestName;
    [TextPropertyInfo("测试名称", 80d, "基础信息", 2)]
    public string TestName
    {
        get { return _TestName; }
        set { _TestName = value; OnPropertyChanged(); }
    }

    private int _Age;
    [NumberTextPropertyInfo("测试年龄", 80d, "基础信息", 1, RegexTextType.Number)]
    [MaxLength(11, ErrorMessage = "最大长度为11")]
    public int Age
    {
        get { return _Age; }
        set { _Age = value; OnPropertyChanged(); }
    }


}

public partial class testNotify2Child : testNotify2
{

    [ObservableProperty]
    [property: TextPropertyInfo("测试名称", 80d, "基础信息2", 1)]
    private string testStr;
}


[CustomSelectorEntity("系统用户",SelectButtonStyleKey ="ButtonSuccess")]
public partial class Sys_User : BillBaseModel
{
    public Sys_User()
    {
        this.CreateTime = DateTime.Now;
    }

    [SugarColumn(IsIgnore = true)]
    public new string BillId { get; set; }

    [SugarColumn(IsIgnore = true)]
    public new string CreateBy
    {
        get; set;
    }

    [SugarColumn(IsIgnore = true)]
    public new DateTime? UpdateTime
    {
        get; set;
    }

    [SugarColumn(IsIgnore = true)]
    public new string UpdateBy
    {
        get; set;
    }

    /// <summary>
    /// Desc:用户编号
    /// Default:
    /// Nullable:False
    /// </summary>
    [SugarColumn(IsPrimaryKey = true, IsNullable = false, ColumnDescription = "主键")]
    public string UserId { get; set; }

    /// <summary>
    /// Desc:用户名称
    /// Default:
    /// Nullable:True
    /// </summary>
    [CustomSelectorProperty("用户名称")]
    public string UserName { get; set; }

    /// <summary>
    /// Desc:姓名首字母
    /// Default:
    /// Nullable:True
    /// </summary>
    [CustomSelectorProperty("姓名首字母")]
    public string Initial { get; set; }

    /// <summary>
    /// Desc:登录ID
    /// Default:
    /// Nullable:True
    /// </summary>
    public string LoginID { get; set; }

    /// <summary>
    /// Desc:密码
    /// Default:
    /// Nullable:True
    /// </summary>
    public string Passwod { get; set; }

    /// <summary>
    /// Desc:状态(0:不可用|1:可用)
    /// Default:
    /// Nullable:True
    /// </summary>
    public int? Status { get; set; }

    /// <summary>
    /// Desc:身份证号
    /// Default:
    /// Nullable:True
    /// </summary>
    public string IDNo { get; set; }

    /// <summary>
    /// Desc:手机号
    /// Default:
    /// Nullable:True
    /// </summary>
    public string PhoneNo { get; set; }

    /// <summary>
    /// Desc:性别(0:女|1:男)
    /// Default:
    /// Nullable:True
    /// </summary>
    public int? Gender { get; set; }

    /// <summary>
    /// Desc:企业管理平台用户ID
    /// Default:
    /// Nullable:True
    /// </summary>
    public string OMUserId { get; set; }

    /// <summary>
    /// Desc:综管平台用户名称
    /// Default:
    /// Nullable:True
    /// </summary>
    public string OMUserName { get; set; }

    /// <summary>
    /// Desc:HR职员ID
    /// Default:
    /// Nullable:True
    /// </summary>
    public string HREmpId { get; set; }

    /// <summary>
    /// Desc:HR职员姓名
    /// Default:
    /// Nullable:True
    /// </summary>
    public string HREmpName { get; set; }



    /// <summary>
    /// Desc:员工工号
    /// Default:
    /// Nullable:True
    /// </summary>
    public string EmployeeNumber { get; set; }
}

public partial class Sys_User : ITreeNode
{
    public string CurId { get; set; }

    public string ParentId { get; set; }

    public object GetCurrentNodeMark()
    {
        return CurId;
    }

    public object GetParentNodeMark()
    {
        return ParentId;
    }

    public bool IsParentNode(ITreeNode parentNode)
    {
        if (parentNode is Sys_User node)
            return ParentId == node.CurId;
        return false;
    }

    public bool IsSameNode(ITreeNode node)
    {
        if (node is Sys_User tmpNode)
            return CurId == tmpNode.CurId;
        return false;
    }

    public bool IsSameParent(ITreeNode node)
    {
        if (node is Sys_User tmpNode)
            return ParentId == tmpNode.ParentId;
        return false;
    }

    public bool IsSubNode(ITreeNode subNode)
    {
        if (subNode is Sys_User tmpNode)
            return tmpNode.ParentId == CurId;
        return false;
    }

    public void SetParentNodeMark(object parentObj)
    {
        ParentId = parentObj.ToString();
    }

    private bool _IsSelected;

    /// <summary>
    /// 是否选中
    /// </summary>
    public bool IsSelected
    { get => _IsSelected; set { _IsSelected = value; OnPropertyChanged(); } }

    private bool _IsExpanded;
    /// <summary>
    /// 是否展开
    /// </summary>

    public bool IsExpanded
    { get => _IsExpanded; set { _IsExpanded = value; OnPropertyChanged(); } }
}

public class TestEventBus : IVampirewalCoreEventFactory
{
    public TestEventBus()
    {
    }

    public string FactoryName => "测试用";

    public void EventFactoryComplate(EventFactoryContext context)
    {
    }

    [EventBusExcute(ExcuteSort = 3)]
    public void TestEvent111111(EventContext context)
    {
        context.PassData = "已修改2";
    }

    //[TestEventBusAop]
    [EventBusExcute(ExcuteSort = 2)]
    public void TestEvent2222222(EventContext context)
    {
        //context.PassData = "SB";
        //throw new Exception("test");
        context.PassData = "已修改1";
    }

    [EventBusExcute(ExcuteSort = 1)]
    public void haha123(EventContext context123)
    {
        context123.PassData = "已修改";
    }
}

public class TestEventBusAopAttribute : EventBusAOPAttribute
{
    public override void ExcuteAfter(EventContext context)
    {
    }

    public override void ExcuteBefore(EventContext context)
    {
    }
}

public interface ITestInterface
{
    void aaa();
}

public interface IDispatcherService
{
    void BeginInvoke(Action act);

}

/// <summary>
/// 测试统一注册消息
/// </summary>
public class TestMessenger : IVampirewalMessageManager
{

    [RegistMethod("TestAAA")]
    public void TestAAA()
    {

    }
}

[VampirewalIoCRegister("MdiViewModel")]
public class MdiViewModel : Vampirewal.Core.SimpleMVVM.ViewModelBase
{
    public MdiViewModel()
    {

    }

    public override void PassData(object obj)
    {

    }
}